<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
	<head>
		<title><xsl:value-of select="database/@name" />.<xsl:value-of select="database/@name" /></title>
		<link href="../../sad/t1.css" type="text/css" rel="stylesheet"/>
	</head>
	<body>

<div class="ReportHeader"><xsl:value-of select="database/@name" />.<xsl:value-of select="database/@name" /></div>
<div class="ReportDetail">
Description: <xsl:value-of select="database/@desc" /><br/>
Revision: <xsl:value-of select="database/@rev" /><br/>
Last Modified: <xsl:value-of select="database/@createdate" /><br/>
</div>
<div class="SectionHeader">Tables</div>
<xsl:for-each select="database/dbtables/table">
<xsl:variable name="tablename" select="@name"/>
<div class="Item">
<div class="ItemCol">
<xsl:value-of select="$tablename" />
<div class="ReportDetail">
Description: <xsl:value-of select="@desc" /><br/>
Revision: <xsl:value-of select="@rev" /><br/>
Last Modified: <xsl:value-of select="@createdate" /><br/>
</div>
<div  class="FieldDIV">
	<table style="border-collapse: collapse;">
	 <tr class="FieldHeader">
     <td style="width: 20px; border-left: solid 1px grey; border-top: solid 1px grey; border-bottom: solid 1px grey;">
       NULL
     </td>
     
			<td style="width: 200px; border-left: solid 1px grey; border-top: solid 1px grey; border-bottom: solid 1px grey;">
			Name
			</td>
			
			<td style="width: 100px; border-top: solid 1px grey; border-bottom: solid 1px grey;">
			Type
			</td>
			
			<td style="width: 100px; border-top: solid 1px grey; border-bottom: solid 1px grey;">
			Size
			</td>
			
			<td style="width: 80px; border-top: solid 1px grey; border-bottom: solid 1px grey;">
			Scale/Precision
			</td>
		</tr>
	  <xsl:for-each select="fields/field" >
	  <tr class="Item">
      <td>
        <xsl:value-of select="IsNotNull" />
      </td>      
		  <td>
			<xsl:value-of select="Name" />
			</td>
		  <td>
			<xsl:value-of select="Type" />
			</td>			
		  <td>
			<xsl:value-of select="Size" />
			</td>
		  <td>
			<xsl:value-of select="Scale" />/<xsl:value-of select="Precision" />
			</td>		
    </tr>
    <tr>
      <td style="padding-left: 15px;">Desc:</td>
      <td colspan="4">
        <xsl:value-of select="Desc" />
      </td>
    </tr>
    <tr>
      <td style="padding-left: 15px;">Default:</td>
      <td colspan="4">
          <xsl:value-of select="DefaultValue" />
        </td>
      </tr>
      <tr>
        <td style="padding-left: 15px;">Constraint:</td>
        <td colspan="4">
          <xsl:value-of select="Constraint" />
        </td>
      </tr>
      <tr>
        <td style="padding-left: 15px;">FK:</td>
        <td colspan="4">
          <xsl:value-of select="ReferencesFK" />
        </td>
      </tr>
	 </xsl:for-each>
		
		</table>
</div>
</div>
</div>
</xsl:for-each>

<table>
<tr>
	<th class="SectionHeader">Views</th>
</tr>
<xsl:for-each select="database/dbviews/view">
<tr class="Item">
<td>
<xsl:value-of select="@name" />
<div class="ReportDetail">
Description: <xsl:value-of select="@desc" /><br/>
Revision: <xsl:value-of select="@rev" /><br/>
Last Modified: <xsl:value-of select="@createdate" /><br/>
</div>
</td>
</tr>
</xsl:for-each>
</table>

<table>
<tr>
	<th class="SectionHeader">Stored Procedures</th>
</tr>
<xsl:for-each select="database/dbprocedures/procedure">
<tr class="Item">
<td>
<xsl:value-of select="@name" />
<div class="ReportDetail">
Description: <xsl:value-of select="@desc" /><br/>
Revision: <xsl:value-of select="@rev" /><br/>
Last Modified: <xsl:value-of select="@createdate" /><br/>
</div>
</td>
</tr>
</xsl:for-each>
</table>

<table>
<tr>
<th class="SectionHeader">Functions</th>
</tr>
<xsl:for-each select="database/dbfunctions/function">
<tr class="Item">
<td>
<xsl:value-of select="@name" />
<div class="ReportDetail">
Description: <xsl:value-of select="@desc" /><br/>
Revision: <xsl:value-of select="@rev" /><br/>
Last Modified: <xsl:value-of select="@createdate" /><br/>
</div>
</td>
</tr>
</xsl:for-each>
</table>

</body>
</html>

</xsl:template>
</xsl:stylesheet>